import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Index',
        component: () => import(/* webpackChunkName: "about" */ '../views/Index.vue'),
     
    },
    // {
    //     path: '/',
    //     name: 'Home',
    //     component: Home
    // },
    {
        path: '/about',
        name: 'About',
        component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import(/* webpackChunkName: "about" */ '../views/Login.vue')
    },
    // {
    //     path: '/menu',
    //     name: 'Menu',
    //     component: () => import(/* webpackChunkName: "about" */ '../views/Menu.vue')
    // },
    // {
    //     path: '/role',
    //     name: 'Role',
    //     component: () => import(/* webpackChunkName: "about" */ '../views/Role.vue')
    // },
    // {
    //     path: '/user',
    //     name: 'User',
    //     component: () => import(/* webpackChunkName: "about" */ '../views/User.vue')
    // }
]

//解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
